<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //打印五行七列星星外循环是行  内循环是列
        /* var str = ''
        for (b = 1 ; b <= 5 ; b++) {
            for (a = 1; a <= 7; a++) {
            str = str + '☆'
        }
        str += '\n'
        }
        console.log(str); */




        //while循环
        //一定要给while加限制条件不然会陷入死循环
        /* var i = 1
        while (i <=100) {
            console.log(i);
            i ++
        } */


        //1 到100的和
        /* var a = 1
        var b = 0
        while (a <=100) {
            b = b + a
            a++
        }
        console.log(b); */


        //1 dao 100 偶数的和
       /*  var a = 1
        var b = 0
        while (a<=100) {
            if (a % 2 == 0) {
                b = b+a
            }
            a++
        }
        console.log(b); */



//用来骂别人傻逼

        /* var a = prompt('你是傻逼吗？')
        while (a != '是的') {
            prompt('你是傻逼吗？')
            a = prompt('你是傻逼吗？')
        }
        alert('哈哈哈傻逼') */



        //do while 语句
        /* var i = 0
        while (i >1) {
            alert('hhh')
        }
        do {
            alert('嘿嘿嘿')
        }while (i>1) */



        //continue 的使用方法  打印不是3 的倍数的数字
        /* for (a = 1 ; a <= 100 ; a++) {
            if (a % 3 === 0 ) {
                continue
            }
            console.log(a); 
        }*/


        //break 的使用方法
        /* for (a = 1 ; a <= 100 ; a++) {
            if (a % 3 === 0 ) {
                break
            }
            console.log(a); 
        } */

    </script>
</body>
</html>
